package com.hanhai.zrb.mobile.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hanhai.zrb.api.biz.service.IntentionService;
import com.hanhai.zrb.mobile.result.BaseApiResult;
import com.hanhai.zrb.mobile.util.FrontLoginUtil;
import com.hanhai.zrb.model.common.BaseUser;
import com.hanhai.zrb.model.intention.Intention;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;

@RequestMapping("/ucenter")
@RestController
public class UserCenterInfoApiController {
	
	
	@Resource
	private IntentionService intentionService;

	@ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") })
	@ApiOperation(value = "查询我的发布列表",  response = BaseApiResult.class, notes = "查询我的发布列表")
	@RequestMapping(value="/findPublish")
	public BaseApiResult updateAppUserInfo(HttpServletRequest request,HttpServletResponse response, Long maxId, Integer limit){
	    BaseApiResult result = new BaseApiResult();
	    BaseUser baseUser = FrontLoginUtil.getCurrentUser();
        if(null!=baseUser){
        	Long uid = baseUser.getUid();
        	List<Intention> findByMaxId = intentionService.findListDtailesBymaxId(uid, maxId, limit);
        	//attentionTimes 总关注次数
        	//messageAmount  留言总数
        	result.setData(findByMaxId);
			result.setRes(1);
			return result;
        }
        result.setMsg("会话超时，请重新登录客户端");
		result.setRes(0);
		return result;
	}
}
